package generic.net;

/**
 * A message can be passed over the network. Any public methods will be encoded
 * using xml and unpacked at the other end.
 * @author Adam Scarr <scarr.adam@gmail.com>
 */
public class Message {
    public String type;

    /**
     * Simple constructor
     * @param type  The type of message.
     */
    public Message(String type) {
        this.type = type;
    }

    /**
     * Empty constructor, needed for XMLDecoder.
     */
    public Message() {

    }

    /**
     * returns the message type.
     * @return
     */
    public String getType() {
        return type;
    }

    /**
     * sets the message type.
     * @param type
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * converts the message to a string for display (mostly in logs).
     * @return
     */
    public String toString() {
        return type;
    }
}
